﻿using GalaSoft.MvvmLight;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace DSParaView
{
    /// <summary>
    /// CtrlLotLimit.xaml 的交互逻辑
    /// </summary>
    public partial class CtrlLotLimit : UserControl
    {
        public CtrlLotLimit()
        {
            InitializeComponent();
        }

        private void BtnClick_Clear(object sender, RoutedEventArgs e)
        {
            var vm = this.DataContext as CtrlLotLimitModel;
            if (vm == null)
                return;
            for (int i = 0; i < vm.ListLotLimit.Count; i++)
            {
                vm.ListLotLimit[i].LotId = "";
            }
        }
    }

    public class CtrlLotLimitModel : ViewModelBase
    {
        private ObservableCollection<LotLimitOneLevelModel> _ListLotLimit = new ObservableCollection<LotLimitOneLevelModel>();
        public ObservableCollection<LotLimitOneLevelModel> ListLotLimit { get { return _ListLotLimit; } set { Set("ListLotLimit", ref _ListLotLimit, value); } }
    }

    public class LotLimitOneLevelModel : ViewModelBase
    {
        private int _level;
        public int level { get => _level; set => Set("level", ref _level, value); }

        private string _LotId = "";
        public string LotId { get => _LotId; set => Set("LotId", ref _LotId, value); }
    }
}